<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="utf-8">
  <title><!--{$lang.page.index.title}--></title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/static/lay/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="/static/lay/layui/index.css" media="all">
</head>
<body>
<div class="layui-fluid">
  <form name="addItem" method="post" lay-filter="component-form-group" class="layui-form">
    <input type="hidden" value="1" name="id">
    <input type="hidden" value="<!--{$datainfo.aids}-->" name="allaids">
    <div class="layui-text-item" style="text-align: center;"><b><!--{$lang.page.public.control}--></b></div>
    <div class="layui-form-item">
        <label class="layui-form-label"><!--{$lang.page.public.slidepoint}--></label>
        <div class="layui-inline" id="submue"  style="width:50%;">
            <table class="layui-table" id="sharetable" lay-filter="table">
                <thead>
                    <tr>
                        <td width="12%"><!--{$lang.page.table.name}--></td>
                        <td width="22%"><!--{$lang.page.table.buyup}--> <!--{$lang.page.public.min}--> <!--{$lang.page.public.multiple}--></td>
                        <td width="22%"><!--{$lang.page.table.buyup}--> <!--{$lang.page.public.max}--> <!--{$lang.page.public.multiple}--></td>
                        <td width="22%"><!--{$lang.page.table.buydown}--> <!--{$lang.page.public.min}--> <!--{$lang.page.public.multiple}--></td>
                        <td width="22%"><!--{$lang.page.table.buydown}--> <!--{$lang.page.public.max}--> <!--{$lang.page.public.multiple}--></td>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                    <td><!--{$lang.page.table.buying}--></td>
                    <td><input type="text" name="buy[upmin]" value="<!--{$datainfo.buy.upmin}-->" lay-verify="double" placeholder="1" autocomplete="off" class="layui-input" /></td>
                    <td><input type="text" name="buy[upmax]" value="<!--{$datainfo.buy.upmax}-->" lay-verify="double" placeholder="3" autocomplete="off" class="layui-input" /></td>
                    <td><input type="text" name="buy[downmin]" value="<!--{$datainfo.buy.downmin}-->" lay-verify="double" placeholder="1" autocomplete="off" class="layui-input" /></td>
                    <td><input type="text" name="buy[downmax]" value="<!--{$datainfo.buy.downmax}-->" lay-verify="double" placeholder="3" autocomplete="off" class="layui-input" /></td>
                    </tr>
                    <tr>
                    <td><!--{$lang.page.table.closeing}--></td>
                    <td><input type="text" name="sell[upmin]" value="<!--{$datainfo.sell.upmin}-->" lay-verify="double" placeholder="1" autocomplete="off" class="layui-input" /></td>
                    <td><input type="text" name="sell[upmax]" value="<!--{$datainfo.sell.upmax}-->" lay-verify="double" placeholder="3" autocomplete="off" class="layui-input" /></td>
                    <td><input type="text" name="sell[downmin]" value="<!--{$datainfo.sell.downmin}-->" lay-verify="double" placeholder="1" autocomplete="off" class="layui-input" /></td>
                    <td><input type="text" name="sell[downmax]" value="<!--{$datainfo.sell.downmax}-->" lay-verify="double" placeholder="3" autocomplete="off" class="layui-input" /></td>
                    </tr>
                  </tbody>
            </table>
        </div>
        <div class="layui-inline" >
        	<table class="layui-table" lay-filter="table">
        		<thead>
                    <tr>
                        <td ><!--{$lang.page.table.operation}--></td>
                        <td ></td>
                    </tr>
                </thead>
        		<tr>
        			<td><!--{$lang.page.table.member}--></td>
        			<td>
        				<div class="layui-form-item" style="margin-bottom: 0px">
            				<div class="layui-inline" style="margin-bottom: 0px">
                				<input type="text" name="aids" class="layui-input" value="">
            				</div>
            				<div class="layui-inline" style="margin-bottom: 0px">
                				<button class="layui-btn" type="button" id="checkuser"><!--{$lang.page.public.select}--></button>
                				<button type="button" class="layui-btn" lay-submit lay-filter="adduser" ><!--{$lang.page.public.submit}--></button>
            				</div>
          				</div>
          			</td>
        		</tr>
        		<tr>
        			<td>修改参数</td>
        			<td>
        				<div class="layui-form-item" style="margin-bottom: 0px">
        				    <div class="layui-inline" style="margin-bottom: 0px">
                			    <button type="button" class="layui-btn" lay-submit lay-filter="submit" ><!--{$lang.page.table.confirm}--></button>
                			    <button type="button" class="layui-btn layui-btn-primary" onClick="xadmin.close();" ><!--{$lang.page.table.back}--></button>
            			    </div>
         			     </div>
          			</td>
        		</tr>
        	</table>          
        </div>
    </div>
    
  </form>
</div>

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <table id="datalist" lay-filter="datalist"></table>
            <script type="text/html" id="toolbartop">
                <button class="layui-btn layui-btn-sm" lay-event="redatalist"><!--{$lang.page.public.refresh}--></button>
                <button class="layui-btn layui-btn-sm add muetool"><!--{$lang.page.public.add}--></button>
            </script>
            <script type="text/html" id="zizeng">{{d.LAY_TABLE_INDEX+1}}</script>
            <script type="text/html" id="bartool">
                <a class="layui-btn layui-btn-danger layui-btn-xs del" data-set="{{d.aid}}"><!--{$lang.page.public.del}--></a>
            </script>
          </div>
        </div>
  </div>

<script src="/static/lay/layui/layui.js"></script>
  <script type="text/javascript">
    layui.config({
     base: '/static/lay/' //静态资源所在路径
   }).extend({
     xadmin: 'lib/xadmin' //弹窗
    ,lang: 'lib/lang' //语言
   }).use(['jquery', 'layer','xadmin', 'form', 'table', 'lang'], function(){
    var $ = layui.$ //引用jq
    var layer = layui.layer; //独立版的layer无需执行这一句
    var form = layui.form;
    var table = layui.table
    form.render(null, 'component-form-group');
     /* 自定义验证规则 */
    form.verify({
    });
    var lang=layui.lang.init();
    table.render({
        elem: '#datalist'
        , height: 'auto'
        , url: 'userinfo' //数据接口
        , method: 'post'
        , page: true //开启分页
        , limit: 10
        , where:{id:1}
        , toolbar: '#toolbartop'
        , defaultToolbar: ['filter', 'exports', 'print']
        , cols: [[ //表头
            {field: 'zizeng', title: function(){ return lang.serial }, align: "center", fixwidth: true, width: 80, templet:'#zizeng'},
            {field: 'username', title: function(){ return lang.account }},
            {field: 'aid', title: function(){ return lang.account+' ID' }},
            {field: 'mobile', title: function(){ return lang.phone }},
            {field: 'amount', title: function(){ return lang.account + lang.balance }},
            {field: 'cash',title: function(){ return lang.withdrawal + lang.money }},
            {fixed: '', title: function(){ return lang.operation }, width: 160, align: 'center', toolbar: '#bartool', hide:false}
        ]],
        done: function() {
            layer.closeAll('loading');
        }
    });
    table.on('toolbar(datalist)', function(obj){
        switch(obj.event){
            case 'redatalist':
                //执行重载
                table.reload('datalist');
            break;
        };
    });  

    form.on('submit(adduser)', function (data) {
    	allaids=$('input[name="allaids"]').val();
    	aids=$('input[name="aids"]').val();
    	if(allaids.includes(aids)){
    		layer.msg('<!--{$lang.page.public.buserok}-->');
    		return;
    	}
        $.post('adduser/',data.field,function(res){
            if(res.code == 200){
              layer.msg(res.msg);
              setTimeout(() => {
                  window.location.reload();
                  // xadmin.close();
              }, 1000);
            }else{
              layer.msg(res.msg);
            }
        })
        return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
    });

    form.on('submit(submit)', function (data) {
          $.post('editslide',data.field,function(res){
              if(res.code == 200){
                  layer.msg(res.msg);
                  setTimeout(() => {
                      window.location.reload();
                      // xadmin.close();
                  }, 1000);
              }else{
                  layer.msg(res.msg);
              }
          })
        return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
    });

    $('#checkuser').on('click', function(){
        var data = 'checkuser';
        layer.open({
          type: 2,
          title: '<!--{$lang.page.public.select}-->',
          offset: '50px', 
          closeBtn: 1, //要显示关闭按钮
          anim: 2,
          shadeClose: true, //开启遮罩
          // moveOut: true,
          area: ['1024px', '700px'],
          content: 'checkuser/'
          ,resize:false
          ,maxmin: false //开启最大化最小化按钮
          ,success:function (layero, index) {
            var iframe = window['layui-layer-iframe'+index]; // 获取子页面的iframe
            iframe.child(data);// 向子页面的全局函数child传参
          }
        });
        window.ppp = function(value){
            if (value) {
              $('input[name="aids"]').val(value.join())
            }
        }
    })
    $(document).on('click', '.del', function(e){
        dataset=e.target.dataset.set;
        $.post('deluser/',{aid:dataset},function(res){
            if(res.code == 200){
              layer.msg(res.msg);
              setTimeout(() => {
                  window.location.reload();
              }, 1000);
            }else{
              layer.msg(res.msg);
            }
        })
    });

  });

  </script>
</body>
</html>

